home *** CD-ROM | disk | FTP | other *** search
- //
- // Event.h
- // Copyright (c) 1989, 1990 by Jiro Nakamura
- // All rights reserved
- //
- // Interface definition of class Event. Event handles the database management
- // of Cassandra.
- // Event is due for total rewriting.
- //
- // RCS Information
- // Revision Number-> $Revision: 1.11 $
- // Last Revised-> $Date: 91/11/01 17:23:52 $
- //
-
- #import <objc/Object.h>
- #import <time.h>
- #import "cass.h"
-
- struct tm *fixAnniversary( struct tm *time, int mode, int sub);
- @interface Event : Object
- {
- char eventFile[128]; // The pathname of the event database
-
- EFileLink present, previous, next; // links to
- //previous and next records and itself
- // See documentation for queue implementation
- // details
- int eventType; // Event type
- // 0 = normal event (appointment)
- // 1 = reminder (day things)
-
- struct tm ts; // time structure see ctime(3) for details
- int priority, // Priority of message (when it gets viewed)
- destroy, // Destroy after message? 0= never destroy
- // 1 = destroy immediately after,
- // 2...n = destroy after n calls
- snoozeNo, // No of snooze times
- snoozeInt, // The snooze intervals themselves (in minutes)
- duration, // Duration of event (for scheduling)
- version; // What version Event file is this?
- // 0,blank - v1.4 or below
- // 1 v1.5 (includes duration)
-
- int anniversary; // Anniversary event,
- // 0 = no anniversary
- // (int) (anniversary / 100) is the "base
- // interval":
- // 1 = daily
- // 2 = weekly
- // 3 = monthly
- // 4 = yearly
- // 5 = special weekly - see "Annv Special Field" for
- // days. Base interval is a binary flag field
- // for which week it is in: Bit 0: First week
- // Bit 4: Fifth week
- // anniversary % 100 is the number of
- // "base interval" that
- // make up the "true interval"
- // between anniversary events
-
- int annvSpecial; // Anniversary special field
- // For Special weekly it holds the days in a binary
- // flag field:
- // Bit 0: Sunday
- // Bit 7: Saturday
-
- enum Actions {nothing, playSound, playAndDeleteSound, runCommand,
- mailPerson} alarmAction;
-
- BOOL showMessage; // Whether to show the alarmPanel or not
-
- char alarmSound[128]; /* The alarm sound name */
- char msg[MESSAGE_SIZE]; /* message buffer */
-
- id global; // Set by IB. Accessor to Global class
- }
- // Constructor: newAt: (const char *) eFile;
- // Description: Constructs new object instance of Event, with the Event
- // reading the file <eFile>
- +newAt: (const char *) eFile;
-
- /* low level routines dealing with event links themselves */
-
- // Method: readEvent : (EFileLink) here
- // Arguments: (EFileLink) here -> the EFileLink to read from
- // Description: Reads the event directly from the queue with <here>
- // as the index.
- // Return Value: <self>
- - readEvent : (EFileLink) here;
-
-
- // Method: writeEvent : (EFileLink) here
- // Arguments: (EFileLink) here -> the EFileLink to write to
- // Description: Writes the event directly into the queue
- // with <here> as the index. Note that this is not an
- // insert, so the next and previous pointers from the
- // last read from this event should be preserved
- // or new pointers should be made and changed
- // appropriately.
- // Return Value: <self>
- - writeEvent : (EFileLink) here; /* write itself into the event file */
-
-
-
- /* Higher level methods that deal somewhat abstractly with the queue */
-
- // Method: firstEvent
- // Arguments: None.
- // Description: reads the first event. Equivalent to:
- // [ev readEvent:0];
- // [ev readEvent: [ev next]];
- // Return Value: returns with the first event read into its internals
- - firstEvent;
-
-
- // Method: (EFileLink) insertEvent
- // Arguments: None, event to be inserted must be already in object
- // Description: Inserts itself into the queue. It is intelligent
- // enough to convert all mistaken dates and times into the
- // proper format before inserting itself, so that other
- // modules that use it can simply add blindly to dates.
- // insertEvent is equivalent to insertEventFrom: 1
- // Return Value: The particular EFileLink that it inserted itself into.
- - (EFileLink) insertEvent;
-
-
- // Method: (EFileLink) insertEventFrom: (EFileLink) here
- // Arguments: (EFileLink) here -> start inserting from <here>
- // Description: Same as insertEvent except that the search
- // for empty events starts from <here>, so that
- // if you KNOW where an deleted EFileLink is,
- // then you can use this method to speed things up
- // somewhat.
- // ReturnValue: The EFileLink that it inserted itself into.
- - (EFileLink) insertEventFrom: (EFileLink) here;
-
-
- // Method: deleteEvent: (EFileLink) here
- // Arguments: (EFileLink) here -> the event to delete
- // Description: Delete the event <here>
- // Return Value: <self>
- - deleteEvent : (EFileLink) here;
-
-
- // Method: int murderEvent : (EFileLink) here
- // Arguments: (EFileLink) here -> the event to "murder"
- // Description: "Murdering" an event deletes an event, but
- // if it is an anniversary
- // event, then it reinstalls it appropriately
- // in the future. See above for description
- // of state variables for "anniversary" events.
- // Return Value: The EFileLink where the new event lies.
- // -1 if it was not reinserted
- - (int) murderEvent : (EFileLink) here;
-
- /* Accessors */
- /* See heading above for description of these variables */
- - (EFileLink) present;
- - (EFileLink) previous;
- - (EFileLink) next;
- - (int) destroy;
- - (int) priority;
- - (int) anniversary;
- - (int) annvSpecial;
- - (int) snoozeNo;
- - (int) snoozeInt;
- - (BOOL) playAlarm;
- - (BOOL) showMessage;
- - (BOOL) deleteSound;
- - (BOOL) mailPerson;
- - (BOOL) runCommand;
-
- - (int) alarmAction;
-
- - (char *) alarmSound;
- - (char *) message;
- - (struct tm *) time;
- - (int) mday; // These access the time structure directly, instead of
- - (int) mon; // using the structure accessors
- - (int) year;
- - (int) hour;
- - (int) min;
- - (int) sec;
- - (int) wday;
- - (int) yday;
-
- - setPresent : (EFileLink) apresent;
- - setPrevious : (EFileLink) aprevious;
- - setNext : (EFileLink) anext;
- - setDestroy : (int) dst;
- - setPriority : (int) si;
- - setAnniversary : (int) anv;
- - setAnnvSpecial: (int) anvS;
- - setSnoozeNo : (int) sn;
- - setSnoozeInt: (int) si;
- - setPlayAlarm: (BOOL) aFlag;
- - setShowMessage: (BOOL) aFlag;
- - setDeleteSound:(BOOL) aFlag;
- - setMailPerson:(BOOL) aFlag;
- - setAlarmSound: (char *) alarmSound;
- - setMessage: (char *) message;
- - setRunCommand: (BOOL) aFlag;
- - setTime : (struct tm *) time;
- - setAlarmAction: (int) aa;
- - setMday : (int) x;
- - setMon: (int) x;
- - setYear: (int) x;
- - setHour: (int) x;
- - setMin: (int) x;
- - setSec: (int) x;
- - setWday: (int) x;
- - setYday:(int) x;
- @end
-
-
-